<template>
  <el-dialog title="查看" :close-on-click-modal="false" :visible.sync="visible" class="view" center>
    <div>
      <p>
        <span>姓名</span>:
        <span>{{name}}</span>
      </p>
      <p>
        <span>头像</span>:
        <span>
          <img :src="headUrl" style="width: 40px; height: 40px;vertical-align: middle;">
        </span>
      </p>
      <p>
        <span>年龄</span>:
        <span>{{age}}</span>
      </p>
      <p>
        <span>性别</span>:
        <span v-if="sex==1">男</span>
        <span v-else>女</span>
      </p>
      <p>
        <span>学校</span>:
        <span>{{school}}</span>
      </p>
      <p>
        <span>身份</span>:
        <span>{{classPosition}}</span>
      </p>
      <p>
        <span>地址</span>:
        <span>{{birthplace}}</span>
      </p>
      <p>
        <span>排序编号</span>:
        <span>{{sortIndex}}</span>
      </p>
      <p>
        <span>开启伴学</span>:
        <span v-if="isRecommended==1">开启</span>
        <span v-else>禁用</span>
      </p>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false" style="text-align:center">返回</el-button>
    </span>
  </el-dialog>
</template>
<style>
.inline {
  display: inline;
}
.types div {
  display: inline;
}
</style>

<script>
export default {
  data() {
    return {
      visible: false,
      name: "",
      sortIndex: "",
      birthplace: "",
      classPosition: "",
      headUrl: "",
      isRecommended: "",
      school: "",
      sex: "",
      sortIndex: "",
      age:'',
    };
  },
  methods: {
    init(id) {
      this.id = id || 0;
      this.visible = true;
      this.$nextTick(() => {
        // this.$refs["dataForm"].resetFields();
        // if (this.dataForm.id) {
        this.$http({
          url: this.$http.adornUrl(`/partner/partnertargetinfo/see/${this.id}`),
          method: "get",
          params: this.$http.adornParams()
        }).then(({ data }) => {
          if (data && data.code === 0) {
            this.name = data.partnerTargetInfo.name;
            this.birthplace = data.partnerTargetInfo.birthplace;
            this.classPosition = data.partnerTargetInfo.classPosition;
            this.headUrl = data.partnerTargetInfo.headUrl;
            this.isRecommended = data.partnerTargetInfo.isRecommended;
            this.school = data.partnerTargetInfo.school;
            this.sex = data.partnerTargetInfo.sex+'';
            this.sortIndex = data.partnerTargetInfo.sortIndex;
            this.age = data.partnerTargetInfo.age
          }
        });
        // }
      });
    }
  }
};
</script>
